package helper;

import java.io.File;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;

public class JAXBObjectReader {
	
	public static <T> T readString(Class<T> clazz, String context) throws JAXBException {
		try {
			JAXBContext jc = JAXBContext.newInstance(clazz);
			Unmarshaller u = jc.createUnmarshaller();
			return (T)u.unmarshal(new File(context));
		} catch (JAXBException e) {
			throw e;
		}
	}

}
